package org.speed.jdk;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

public class CompletableFutureDemo {
	
	
	
	public static void main(String[] args) {
	
		
		CompletableFuture<String> future = CompletableFuture.supplyAsync(() -> {
			
			try {
				Thread.sleep(1000 * 10);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			
			String value = "1000";
			
			return value;
		});
		
		future.complete("100");
		
        try {
            System.out.println(future.get());
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }

        System.out.println("CompletableFuture");
		 
	}
	

}
